Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/text

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/text

Text via the Canvas API

  • 5.3.12
  • latest-5.3.x
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @pixi/text?

@pixi/text is a package within the PixiJS library that provides functionality for creating and manipulating text objects in a 2D WebGL renderer. It allows developers to add, style, and animate text in their PixiJS applications.

What are @pixi/text's main functionalities?

Basic Text Creation

This feature allows you to create a basic text object and add it to the PixiJS stage. The text can be positioned using the x and y properties.

const app = new PIXI.Application();
document.body.appendChild(app.view);
const basicText = new PIXI.Text('Hello Pixi!');
basicText.x = 50;
basicText.y = 100;
app.stage.addChild(basicText);

Styled Text

This feature allows you to create text with various styles such as font family, size, color, stroke, and drop shadow. The TextStyle object is used to define these styles.

const style = new PIXI.TextStyle({
  fontFamily: 'Arial',
  fontSize: 36,
  fill: 'white',
  stroke: '#ff3300',
  strokeThickness: 4,
  dropShadow: true,
  dropShadowColor: '#000000',
  dropShadowBlur: 4,
  dropShadowAngle: Math.PI / 6,
  dropShadowDistance: 6,
});
const richText = new PIXI.Text('Styled Text', style);
richText.x = 50;
richText.y = 150;
app.stage.addChild(richText);

Text Animation

This feature allows you to animate text objects. In this example, the text is rotated continuously using the app's ticker.

const animatedText = new PIXI.Text('Animating Text');
animatedText.x = 50;
animatedText.y = 200;
app.stage.addChild(animatedText);
app.ticker.add(() => {
  animatedText.rotation += 0.01;
});

Other packages similar to @pixi/text

FAQs

Package last updated on 23 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc